function insRow() {
    var rowNums = document.getElementById("planTable").rows.length;//获取table行数
    var irow = document.getElementById("planTable").insertRow(rowNums);//向第rowNums插入行
    var name = irow.insertCell(0);
    var phone = irow.insertCell(1);
    var sex = irow.insertCell(2);
    var opr = irow.insertCell(3);
    name.innerHTML = "<input type='text' name='name' onchange=\"changeContent()\"/>";
    phone.innerHTML = "<input type='text' name='phone' onchange=\"changeContent()\"/>";
    sex.innerHTML="<input type='text' name='sex' onchange=\"changeContent()\"/>";
    opr.innerHTML="<a href=\"videoQuery.html\"><input type=\"button\" value=\"分配视频资源\" ></a>&nbsp;&nbsp;\n" +
        "                    <a href=\"documentQuery.html\"><input type=\"button\" value=\"分配文档资源\" ></a>&nbsp;&nbsp;\n" +
        "                    <input type=\"button\" value=\"删除\" onclick=\"delRow(this)\">";
}
function  delRow(r) {
    var i=r.parentNode.parentNode.rowIndex;
    document.getElementById("planTable").deleteRow(i);
}
function changeContent() {
    var arrays=new Array();
    var nameArray=new Array();
    var phoneArray = new Array();
    var sexArray = new Array();
    var cellNums = (document.getElementById("planTable").rows[0].cells.length)-1;
    var rowNums = document.getElementById("planTable").rows.length;
    for (var i=0;i<rowNums;i++){
        nameArray[i]=document.getElementById("planTable").rows[i].cells[0].getElementsByTagName("input")[0].value();
    }
    for (var i=0;i<rowNums;i++){
        phoneArray[i]=document.getElementById("planTable").rows[i].cells[1].getElementsByTagName("input")[1].value();
    }
    for (var i=0;i<rowNums;i++){
        sexArray[i]=document.getElementById("planTable").rows[i].cells[2].getElementsByTagName("input")[2].value();
    }
    var data=[];//json对象
    for (var i=0;i<nameArray.length;i++){
        data.push(
            {
            "name":nameArray[i],
            "phone":phoneArray[i],
            "sex":sexArray[i]
            }
            );
    }
    //json字符串
    var strdata = JSON.stringify(data);
    document.getElementById("hd1").value=strdata;
}
